package com.cq.digitalemployee.shiro.controller;

import com.cq.digitalemployee.result.BaseResult;
import com.cq.digitalemployee.result.FailureResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * shiro相关控制器
 *
 * @author zzz
 */
@RestController
@RequestMapping("/error")
public class ShiroController {

    /**
     * 未授权返回
     *
     * @return the base result
     */
    @RequestMapping("/unauthorized")
    public BaseResult unauthorized(){
        FailureResult failureResult = new FailureResult();
        failureResult.setMsg("未授权的访问");
        failureResult.setStatusCode("403");
        return failureResult;
    }

    /**
     * 未登录返回
     *
     * @return {}
     */
    @RequestMapping("/notLogin")
    public BaseResult notLogin(){
        FailureResult failureResult = new FailureResult();
        failureResult.setMsg("未登录的访问");
        failureResult.setStatusCode("403");
        return failureResult;
    }

}
